var pageParamStr = $.url().param('pageParam');
var pageParam = JSON.parse(pageParamStr);

var paper = {
	paperId: '',
	staffId: pageParam.staffId,
	paperType: pageParam.paperType,
	startNum: 0,
	endNum: 0,
	useNum: 0,
	createId: pageParam.staffId,
	updateId: pageParam.staffId,
	createTime: '',
	updateTime: '',
};

var view = {
	data: paper
};

var vue_vm = new Vue({
	el: '#vue_vm',
	data: view,
	methods: {
		getTitle:function() {
			var paperTypeName = '';
			
			switch(parseInt(pageParam.paperType)) {
				case 1:
					paperTypeName = '发票';
					break;
				case 2:
					paperTypeName = '预交款收据';
					break;
				case 3:
					paperTypeName = '收费凭据';
					break;
				case 4:
					paperTypeName = '退费';
					break;
			}
			
			var title = '用户姓名：' + pageParam.staffName + ' 票据类型：' + paperTypeName;
			return title;
		}
	}
});

function save() {
	if(!isPositiveInt(view.data.startNum) || !isPositiveInt(view.data.endNum)) {
		alert('起始号、结束号都必须为正整数');
		return;
	}
	
	save_basic(path+'/paper/save', {paper:view.data}, function() {
		alert('保存成功');
	});
}